﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HRWebApp
{
    public partial class Employee : System.Web.UI.Page
    {
        HumanResources.Company thecompany;

        protected void Page_Load(object sender, EventArgs e)
        {
            thecompany = (HumanResources.Company)Session["company"];
        }

        protected void OnSave(object sender, EventArgs e)
        {
            try
            {
                float salary = float.Parse(SalaryTb.Text);
                HumanResources.Employee emp = new HumanResources.Employee(
                    NameTb.Text, SSNTb.Text, salary);
                thecompany.Hire(emp);
                Response.Redirect("Default.aspx");
            }
            catch (Exception)
            {
                
                throw;
            }
        }
    }
}